package tongwentongshu.com.app.adapter;


import android.content.Context;
import android.util.Log;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import tongwentongshu.com.app.R;
import tongwentongshu.com.app.bean.MyShareBean;
import tongwentongshu.com.app.utils.GlideUtil;

/**
 * 文 件 名: MainBooksAdapter
 * 创 建 人: Allen
 * 创建日期: 16/12/24 19:55
 * 邮   箱: AllenCoder@126.com
 * 修改时间：
 * 修改备注：
 */
public class PreShareAdapter extends BaseQuickAdapter<MyShareBean.DataBean, BaseViewHolder> {
    private Context mContext;

    public PreShareAdapter(Context mContext, List<MyShareBean.DataBean> list) {
        super(R.layout.view_pre_share, list);
        this.mContext = mContext;
    }

    @Override
    protected void convert(BaseViewHolder helper, MyShareBean.DataBean item) {
        helper.setText(R.id.tv_book_name, item.getBookname());
        helper.setText(R.id.tv_book_type, "【" + item.getBooktype() + "】");
        helper.setText(R.id.tv_book_share_time, "分享时间：" + item.getSharetime());
        Log.e("tv_book_name", item.getBookname());
        String bookStatus = "";
        switch (item.getBookstatus()) {
            case "1":
                bookStatus = "被预约";
                break;
            case "2":
                bookStatus = "在读";
                break;
            case "3":
                bookStatus = "空闲";
                break;
            default:
                break;
        }
        helper.setText(R.id.tv_book_status, bookStatus);
        helper.setText(R.id.tv_book_info, "书籍简介：" + item.getBookdesc());
        helper.setText(R.id.tv_book_reader_num, item.getPersonnum() + "人\n看过");
        GlideUtil.setImage1(mContext, item.getBookpicurl(), R.drawable.default_graph, R.drawable.default_graph, (ImageView) helper.getView(R.id.iv_book_image));
    }


}
